<%--
  Created by IntelliJ IDEA.
  User: leman
  Date: 2017/7/11
  Time: 14:48
  To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<html>
<head>
    <link href="<%=path%>/plugins/layui/css/layui.css" type="text/css" rel="stylesheet" />
</head>
<body>
    <div class="layui-form-item" style="margin: 15px;">
        <div class="layui-inline">
            <label class="layui-form-label">调整前距离</label>
            <div class="layui-input-inline">
                <input type="text" id="distance" class="layui-input layui-disabled" value="${distance}" readonly="readonly">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">调整后距离</label>
            <div class="layui-input-inline">
                <input type="number" id="aftDistance" class="layui-input" value="${distance}" onkeyup="functionFn()">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">调整前价格</label>
            <div class="layui-input-inline">
                <input type="text" id="orderCost" class="layui-input layui-disabled" value="${orderCost}" readonly="readonly">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">调整后价格</label>
            <div class="layui-input-inline">
                <input type="number" id="aftCost" class="layui-input" value="${orderCost}" onkeyup="functionFn()">
            </div>
        </div>

        <div class="layui-inline">
            <label class="layui-form-label">调整原因</label>
            <div class="layui-input-inline">
                <input name="comment" id="comment"  rows="" cols="" style="width: 99.8%;height: 60px;" onkeyup="functionFn()">
            </div>
        </div>
    </div>
    <script>
        //获取后台页面的值：订单价，调整金额，结算价
        var orderCost=parseInt("${orderCost}");
        var distance=parseInt('${distance}');
        //点击和鼠标按下事件
        function functionFn(){
            var dd=document.getElementById('aftDistance').value;//调整后距离
            var dddd=document.getElementById('distance').value;//调整距离
            var ss=document.getElementById('aftCost').value;//调整后价格
            var ssss=document.getElementById('orderCost').value;//调整价格
            var zzz=document.getElementById('comment').value;//调整原因
            //赋值给父页面：订单价，调整金额，结算价，调整原因
            parent.document.getElementById('aftDistance').value=(dd);
            parent.document.getElementById('distance').value=(dddd);
            parent.document.getElementById('aftCost').value=(ss);
            parent.document.getElementById('orderCost').value=(ssss);
            parent.document.getElementById('comment').value=zzz;

        }
        //初始化加载，把值给父页面
        window.onload=function(){
            parent.document.getElementById('orderCost').value=document.getElementById('orderCost').value;
            parent.document.getElementById('aftCost').value=document.getElementById('aftCost').value;
            parent.document.getElementById('distance').value=document.getElementById('distance').value;
            parent.document.getElementById('aftDistance').value=document.getElementById('aftDistance').value;
            parent.document.getElementById('comment').value=document.getElementById('comment').value;
        }
    </script>
</body>
</html>
